package com.yym.cloudweb.crawl.station.jd;

import com.yym.cloudweb.entity.Good;
import com.yym.cloudweb.mapper.GoodMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import java.util.List;

@Component
public class JdGpuPipeline implements Pipeline {

    @Autowired
    GoodMapper goodMapper;

    @Override
    public void process(ResultItems resultItems, Task task) {
        List<Good> goodList = resultItems.get("goodList");
        for(Good good : goodList){
            goodMapper.add(good);
        }
    }

}
